package com.ruoyi.common.utils;


import java.util.Date;

/**
 * 编码生成工具类
 * @author wux
 * @date 2023/5/24 9:32
 */
public class CodeUtils {
    public static String getProdCode(String tunnel, String tunnelArea, String steel, String unit){
        StringBuffer sb = new StringBuffer();
        //隧道名称前3位首拼加部位首拼
        String  pYtunnel = PingYinUtil.getPinYinHeadChar(tunnel);
        String tunnelStr = pYtunnel.length()>3 ? pYtunnel.substring(0,3):pYtunnel;
        String pyArea = PingYinUtil.getPinYinHeadChar(tunnelArea);
        sb.append("GGJ-").append(tunnelStr).append(pyArea).append(steel).append(unit);
        return sb.toString();
    }

    public static String getProdTaskCode(int taskNum) {
        return "JH-" + DateUtils.parseDateToStr("yyyyMMdd",new Date()) + String.format("%02d", taskNum + 1);
    }

}
